const http = require('http');

var options = {
    hostname: 'www.baidu.com'
}

var req = http.get(options,(res)=>{
    console.log('Status: ' + res.statusCode);
    console.log('Headers:');
    console.log(res.headers);
    res.setEncoding('utf-8');
    res.on('data',(chunk)=>{
        console.log(chunk);
    });
    
});
